package com.android.djlmapp.js_interface.buka;

import android.content.Context;
import android.webkit.JavascriptInterface;

import com.android.djlmapp.js_interface.BaseJsInterface;
import com.just.agentweb.AgentWeb;

/**
 * @Author wangziheng
 * @ProjectName djlm
 * @ClassName BukaJsInterface
 * @package com.android.djlmapp.js_interface.buka
 * @data 2019/2/11 18:47
 * @Describe
 * @Change
 */
public class BukaJsInterface extends BaseJsInterface {
    private AbBukaJsInterfaceCallBack mBukaJsInterfaceCallBack;

    public BukaJsInterface(Context context, AbBukaJsInterfaceCallBack jsInterfaceCallBack, AgentWeb agentWeb) {
        super(context, jsInterfaceCallBack, agentWeb);
        mBukaJsInterfaceCallBack = jsInterfaceCallBack;
    }

    /**
     * 读身份证
     */
    @JavascriptInterface
    public void read_idcard() {
        getHandler().post(() -> mBukaJsInterfaceCallBack.readIDCard());
    }

    /**
     * 上传照片
     */
    @JavascriptInterface
    public void up_img() {
        getHandler().post(() -> mBukaJsInterfaceCallBack.upImg());
    }

    /**
     * 选择照片
     */
    @JavascriptInterface
    public void up_images() {
        getHandler().post(() -> mBukaJsInterfaceCallBack.upImgs());
    }

    /**
     * 补卡回调
     *
     * @param json
     */
    @JavascriptInterface
    public void onSubmit(String json) {
        getHandler().post(() -> mBukaJsInterfaceCallBack.bkSubmit(json));
    }
}
